﻿using PropertyChanged;
using StarryEdge.Core.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace StarryEdge.Core.Models
{
    public class DeviceInfoModel : INotifyPropertyChanged
    {
        /// <summary>
        /// 序号
        /// </summary>
        public int Index { get; set; }

        /// <summary>
        /// 波特率或端口号
        /// </summary>
        public int Port { get; set; }

        /// <summary>
        /// 是否网络设备
        /// </summary>
        [DoNotNotify]
        public bool IsSocket { get; set; }

        [DoNotNotify]
        public bool IsUDP { get; set; }

        /// <summary>
        /// IP或端口号
        /// </summary>
        public string IPCOM { get; set; }

        /// <summary>
        /// 设备类型
        /// </summary>
        public DeviceTypes DeviceType { get; set; }
        /// <summary>
        /// 任务名
        /// </summary>
        public string TaskName { get; set; }
        /// <summary>
        /// 服务名
        /// </summary>
        public string ServiceName { get; set; }

        /// <summary>
        /// ping时间
        /// </summary>
        public long PingTime { get; set; }

        /// <summary>
        /// Ping结果
        /// </summary>
        public IPStatus ICMPResult { get; set; }

        /// <summary>
        /// 是否在线
        /// </summary>
        [JsonIgnore]
        public bool? IsOnline { get; set; } = null;
        [JsonIgnore]
        public int PingNGCount { get; set; }

        public byte StationNumber { get; set; } = 1;

        public event PropertyChangedEventHandler PropertyChanged;

    }
}
